#!/bin/bash

echo 'Fe server start building...'

PROJECT_DIR=/me
NGINX_DIR=/home

cd ~
cd ${PROJECT_DIR}
git pull
# 安装依赖
rm -rf node_modules
rm -rf pnpm-lock.yaml
pnpm install
# 删除旧包
rm -rf me
rm -rf me.tar
rm -rf ${NGINX_DIR}/me
rm -rf ${NGINX_DIR}/me.tar
# 打包
npm run build
# 压缩包并复制到nginx目录
tar -cf me.tar me
cp me.tar ${NGINX_DIR}
# 进入nginx目录并解压
cd ~
cd ${NGINX_DIR}
tar -xf me.tar
